/**
 * projectName: zhouheng
 *
 * @author: smileheng
 * time: 2021/7/29 17:59
 * description:${description}
 */
public class AtomicIntegerTest {
    private static volatile int a = 0;
    public static void main(String[] args) {
        Thread[] threads = new Thread[5];
        for (int i = 0; i < 5; i++) {
           threads[i] = new Thread(() -> {
               try {
                   for (int j = 0; j < 10; j++) {
                       System.out.println(a++);
                       Thread.sleep(500);
                   }
               } catch (InterruptedException e) {
                   e.printStackTrace();
               }
           });
           threads[i].start();
        }

    }

}

